#for

for i in range(1,10):
    for j in range(1,i+1):
        print('{:1}*{:1}={:<2}'.format(i,j,i*j),end='  ')
    print()
print()
for i in range(9,0,-1):
    for j in range(1,i+1):
        print('{:1}*{:1}={:<2}'.format(i,j,i*j),end='  ')
    print()
print()
for i in range(1,10):
    for j in range(1,10-i):
        print(' '*6,end='  ')
    for j in range(10-i,10):
        print('{:1}*{:1}={:<2}'.format(i,10-j,i*(10-j)),end='  ')
    print()
print()
for i in range(9,0,-1):
    for j in range(1,10-i):
        print(' '*6,end='  ')
    for j in range(10-i,10):
        print('{:1}*{:1}={:<2}'.format(i,10-j,i*(10-j)),end='  ')
    print()
print()

#while
i=1
while i<=9:
    j=1
    while j <=i: 
        print('{:1}*{:1}={:<2}'.format(i,j,i*j),end='  ')
        j=j+1
    print()
    i=i+1
print()
i=9
while i>=1:
    j=1
    while j<=i:
        print('{:1}*{:1}={:<2}'.format(i,j,i*j),end='  ')
        j+=1
    print()
    i-=1
print()
i=1
while i<=9:
    j=1
    while j<=9-i:
        print(' '*6,end='  ')
        j+=1
    while j<=9:
        print('{:1}*{:1}={:<2}'.format(i,10-j,i*(10-j)),end='  ')
        j+=1
    print()
    i+=1
print()
i=9
while i>=1:
    j=1
    while j<=9-i:
        print(' '*6,end='  ')
        j+=1
    while j<=9:
        print('{:1}*{:1}={:<2}'.format(i,10-j,i*(10-j)),end='  ')
        j+=1
    print()
    i-=1
print()

